<template>
	<view class="">
		<view class="flex justify-between border-b-1 border-b-solid border-gray-200 px-30 py-20">
			<view class="font-bold">
				商品评论
			</view>
			<navigator :url="`/pages/comment/index/index?gid=${goods.id}`" class="text-gray-700">
				所有评论
			</navigator>
		</view>

		<scroll-view scroll-x="true" style="white-space: nowrap;" class="goods-comment-swiper p-20">
			<view v-for="comment in comments" :key="comment.id" class="inline-block mr-20" v-show="comment.images">
				<hd-comment-item :goods="goods" :comment="comment" :showReply="false" :truncateContent="true"/>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		props: ['goods'],
		data() {
			return {
				comments: []
			}
		},
		async created() {
			const res = await this.$api.get(`goods/${this.goods.id}/comment`)
			this.comments = res.data;
		}
	}
</script>

<style lang="scss">

</style>
